import { createSlice } from '@reduxjs/toolkit'

export const counterSlice = createSlice({
  name: 'counter',
  initialState: {
    value: false,
    Cardname: "干净",
    RoomChinkList: [],
    TrueList: {}, // 选中的数据
    ChinkListFlag: true,// 只能执行一次UsercheckinList 添加入住记录
    BULostCard: {},
    LostRoomNum: "",// 房间ID
    LostRoomID: "", // 房号
    GetNowCardMsg:{},  // 获取当前退卡信息
    ChangeRoomList:[], // 套房换套房的数据
  },
  reducers: {
    increment: state => {
      state.value = true
    },
    decrement: state => {
      state.value = false
    },
    incrementByAmount: (state, action) => {
      state.value = action.payload
    },
    changeCardname: (state, action) => {
      state.Cardname = action.payload
    },
    changeRoomChinkList: (state, action) => {
      state.RoomChinkList = action.payload
    },
    changeTrueList: (state, action) => {
      state.TrueList = action.payload
    },
    changeChinkListFlag: (state, action) => {
      state.ChinkListFlag = action.payload
    },
    changeBULostCard: (state, action) => {
      state.BULostCard = action.payload
    },
    changeLostRoomNum: (state, action) => {
      state.LostRoomNum = action.payload
    },
    changeLostRoomID: (state, action) => {
      state.LostRoomID = action.payload
    },
    setGetNowCardMsg:(state, action)=>{
      state.GetNowCardMsg = action.payload
    },
    setChangeRoomList:(state, action)=>{
      state.ChangeRoomList = action.payload
    }
  }
})
// 每个 case reducer 函数会生成对应的 Action creators
export const { changeChinkListFlag, changeTrueList,
  increment, decrement, incrementByAmount,setGetNowCardMsg,setChangeRoomList,
  changeCardname, changeRoomChinkList, changeBULostCard, changeLostRoomNum, changeLostRoomID
} = counterSlice.actions

export default counterSlice.reducer